﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using orders.Model;
using orders.Repository;
using orders.Service;
using System.Collections.Generic;

namespace orders.Controllers
{
    [Route("api/[controller]")]
    public class OrderController: Controller
    {
        private readonly IOrderService _orderService;
        private readonly IOptions<DapperOptions> _optons;
        public OrderController(IOrderService orderService)
        {
            _orderService = orderService;
        }

        [HttpGet]
        [Produces("application/json")]
        public string GetS()
        {
            return _optons.Value.ConnectionString;
        }

        [Route("detail")]
        [HttpGet]
        [Produces("application/json")]
        public IEnumerable<OrderDetail> Get()
        {
            return _orderService.GetOrderDetailList();
        }
    }
}
